<?php $config=config('UPLOAD') ?>
<style>
body, html { overflow: hidden }
.buttons { padding:10px; text-align:right}
</style>
</head><body>
<script>
var win;
var uploadComplete = new function(){}; 
Do.ready('base', 'dialog', 'swfobject',function() {
	var win = art.dialog.open.origin;
	function getFlash(flashID) 
	{
		// 判断浏览器类型
		if (navigator.appName.indexOf("Microsoft") != -1) 
		{
			return window[flashID];
		} 
		else 
		{
			return document[flashID];
		}
	}
			
	window.uploadComplete=function uploadComplete(data)
	{
		var data=eval("("+data+")");
		if(data.status=='y')
		{
			$('#file_id',win.document).val($('#file_id',win.document).val()+data.info.id+',');
			$('#{$id}',win.document).val(data.info.url);
			<?php if($pic){ ?>
			$('#{$pic}',win.document).attr('src',data.info.url);
			<?php } ?>
			art.dialog.close();
		}else{
			art.dialog.tips(data.info, 3);
		}
	}
	$('#upload').click(function(){
		getFlash('myFlashID').upload();
	});
	$('#close').click(function(){
		art.dialog.close();
	});
	var swfVersionStr = "10.0.0";
	var xiSwfUrlStr = "__PUBLIC__/ui/upload/expressInstall.swf";
	var flashvars = {};
	flashvars.picurl = '{$file}';
	flashvars.uploadurl = '<?php echo base64_encode(url("upload/crop_upload",array("ajax"=>1,"file"=>$file))); ?>';
	var params = {};
	params.quality = "high";
	params.bgcolor = "#ffffff";
	params.allowscriptaccess = "always";
	params.allowfullscreen = "true";
	var attributes = {};
	attributes.id = "myFlashID";
	attributes.name = "myFlashID";
	attributes.align = "middle";
	swfobject.embedSWF("__PUBLIC__/ui/upload/Main.swf", "flashContent", "680", "480", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes); 
});
</script>
<div id="flashContent">
</div>
<div class="buttons">
<button class="u-btn" id="upload" type="button">保存</button>
<button class="u-btn u-btn-c4" id="close" type="button">取消</button>
</div>
</body>